package com.xs.operator;

import java.util.Random;
import java.util.Scanner;

public class operatorDemo6 {
    public static void main(String[] args) {
            Random r=new Random();
            int a=r.nextInt(100)+1;
            System.out.println("这里有个1到100的随机数，你觉得是多少呢?猜猜吧：");
            while (true){
                Scanner scanner=new Scanner(System.in);
                int b=scanner.nextInt();
                if (a==b){
                    System.out.println("你猜对了答案就是"+b);
                    break;
                }
                else if(a>b){
                    System.out.println("你猜小了");
                }
                else {
                    System.out.println("你猜大了");
                }
            }
    }
}
